#ifndef __EKOS_USER_PCI_H__
#define __EKOS_USER_PCI_H__

#include "ulib.h"

// PCI subsystem interface
enum { pci_res_bus, pci_res_mem, pci_res_io, pci_res_max };

struct pci_bus_t;

struct pci_dev_t
{
	 uint32_t dev;
	 uint32_t func;

	 uint32_t dev_id;
	 uint32_t dev_class;

	 uint32_t reg_base[6];
	 uint32_t reg_size[6];
	 uint8_t irq_line;
};

struct pci_func_t
{
	 struct pci_bus_t *bus;	// Primary bus for bridges
	 struct pci_dev_t dev;	 
};

struct pci_bus_t
{
	 struct pci_func_t *parent_bridge;
	 uint32_t busno;
};

extern struct ipc_node_t pci_ipc;

#define PCI_ATTACH_BY_CLASS  0
#define PCI_ATTACH_BY_VENDOR 1

void pci_start(void);

#endif
